<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@page pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/controlesessao.jspf"%>

<sql:query var="query" dataSource="jdbc/dbo_MicrosoftSQLServer">
    select distinct c.id_componente,desc_componente
    from Componentes c
    inner join grades g on g.id_componente=c.id_componente
    where g.id_modulo=?
    order by c.desc_componente
    <sql:param value="${param.id_modulo}"/>
</sql:query>
<c:choose>
    <c:when test="${!empty query.rows}">
        <label class="lbInput">Componente<em>*</em></label>
        <select id="id_componente" name="id_componente" class="required">
            <option value="">Selecione um componente</option>
            <c:forEach var="row" items="${query.rows}">
                <option value="${row.id_componente}" ${row.id_componente==param.id_componente?'selected':''}>${row.desc_componente}</option>
            </c:forEach>
        </select>
        <script>
            $("#id_componente").change(function(){
                if( $("#docente").empty()){
                    getDocentes();
                }
            }); 
        </script>


    </c:when>
    <c:otherwise>
        <p style="font-size: 12pt; color: red">Nenhum componente foi encontrado para o curso/módulo.</p>
    </c:otherwise>

</c:choose>

